package com.yjz.leetcode.合并两个有序链表;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

/**
 * @author :yuanJinZhong
 * @description:移除单向链表中的某一节点测试
 * @date :2018/7/16-15:50
 */
@Slf4j
public class RemoveNodeSolutionTest {

  @Test
  public void RemoveNodesTest() {
    /**
     * 单链表
     */
    ListNode fullNode = new ListNode(1);
    fullNode.next = new ListNode(2);
    fullNode.next.next = new ListNode(3);
    fullNode.next.next.next = new ListNode(4);
    fullNode.next.next.next.next = new ListNode(5);
    fullNode.next.next.next.next.next = new ListNode(6);
    fullNode.next.next.next.next.next.next = new ListNode(7);
    log.info(fullNode.toString());

    /**
     * 中间节点,只知道引用
     */
    ListNode midNode = fullNode.next.next.next;

    log.info(midNode.toString());

    /**
     * 从单链表中移除中间节点
     */
    ListNode result = new RemoveNodeSolution().removeOneNode(fullNode, midNode);

    log.info(result.toString());
  }

}
